SpatialStream® Code Examples

Public School Locations

Using SpatialStream® Public School layer, SLD (Stylized Layer Descriptor), and GetMap components, you can access nationwide School Location Data and basic attributes for display in your mapping application. This example will demonstrate how to add the Public School layer for the entire US. The SLD component allows you to apply an icon and add labels based on attributes in the Public School layer and tailor the following display parameters of your locations: icon, icon background color, and size. Once the SLD is defined, the GetMap component generates the overlay for your map.

The primary benefit of defining a layer’s style in an SLD is that the layer style definitions are maintained outside the code, so making changes to the layer style are fast and easy as application code doesn’t need to be changed to do so. Because layer styling is separate from the application, you have the option of letting data visualization experts style your layers, who may not necessarily be your application programmers.

SLD | GetMap


layer = new Dmp.Layer.WmsLayer("SC", "SS");
layer.addChild("point", "SS.Admin.MP.PublicSchools/PublicSchools", "PUBLIC_FOLDER/Styles/PublicSchools_Maponics/School.sld.xml", {
zIndex: 100, zoomRange: {
min: 10, max: 19
}
});
map.addEntity(layer);

//----------------

var url = "Identify.aspx" +
"?returnGeoType=1" +
"&dataSource=SS.Admin.MP.PublicSchools/PublicSchools" +
"&BufferUint=4" +
"&BufferDist=" + getTolerance() +
"&showSchema=false" +
"&lat=" + loc.latitude +
"&long=" + loc.longitude +
"&fields=*";


var filter = getFilter().replace("&", "%26");

if (filter.length > 0) {

url += "&query=" + filter;
}

Dmp.Env.Connections["SS"].getJson(url, successCallback, errorCallback);


Run Sample   Back To Index